
	
<div class='span12'>
	<h1><?php echo $this->Html->link($page_title, '/'); ?></h1>
	<div class="btn-group">
	  <?php echo $this->Html->link('Nueva Mesa', array('controller'=>'tables', 'action'=>'add'),array('class'=>'btn btn-success'));?>
	  <span class="divider">|</span>
	  <a href="#" id='edit_bt' class="btn btn-success">Editar</a>
	  <span class="divider">/</span>
	  <a href="#" id='delete_bt' class="btn btn-success">Eliminar</a>
	</div>
	<hr>
	<table class="table table-bordered">
		<thead>
			<tr>
				<th></th>
				<th>Name</th>
				<th>Event_id</th>
				<th>Table Type</th>
				<th>Importe</th>
				<th>Limite de Jugadores</th>
				<th>Jugadores</th>
				<th>Total</th>		
				<th>Estado</th>
				<th>Creado</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach($tables as $table):?>
				<tr>
					<td><input type='checkbox' name='users[]' value='<?php echo $table['Tables']['id']?>' > </td>
					<td><?php echo $table['Tables']['name']?></td>
					<td><?php echo $this->Html->link($table['Tables']['event_id'], array('controller'=>'users', 'action'=>'view',$table['Tables']['event_id']));?></td>		
					<td><?php echo $table['Tables']['table_type_id']?></td>
					<td><?php echo $table['Tables']['amount']?></td>
					<td><?php echo $table['Tables']['total_amount']?></td>
					<td><?php echo $table['Tables']['player_quota']?></td>
					<td><?php echo $table['Tables']['players']?></td>
					<td><?php echo $table['Tables']['status']?></td>
					<td><?php echo $table['Tables']['created']?></td>

				</tr>
			<?php endforeach;?>
		</tbody>
	</table>
	
</div>	
<br>
<br>
<br>
<br>
<br>
<br>



<script type="text/javascript">
  $(function(){
    function get_check_id(){
        var result=0;
        $('input[type="checkbox"]').each(function() {
            if( $(this).is(":checked")){
                var user_id = $(this).val();
                // window.location.replace("/backend/users/contact/"+user_id);
                result =  user_id;
            }
        });
        return result;
    }

    $("#edit_bt").click(function()
    {
	    var eid= get_check_id();
	    if (eid != 0)
        {
        	console.debug("testing");
        	window.location.replace("users/edit/"+eid);
        }
    });
    $("#delete_bt").click(function()
    {
	    var eid= get_check_id();
	    if (eid != 0)
        {
        	console.debug("testing");
        	window.location.replace("users/delete/"+eid);
        }
    });

  });

</script>